#include <iostream>
#include <string>

using namespace std;

struct hero {
    string  name;
    int     age;
    string  gender;
};

int main() {
    struct hero a[5] = {
    {"刘备",23,"男"},
    {"关羽",22,"男"},
    {"张飞",20,"男"},
    {"赵云",21,"男"},
    {"貂蝉",19,"女"} };
    int len = sizeof(a) / sizeof(a[0]);

    for (int i = 0; i < len; i++) {
        for (int j = 0; j < len - i-1; j++) {
            if (a[j].age < a[j + 1].age);
            else {
                hero mid;
                mid = a[j];
                a[j] = a[j + 1];
                a[j + 1] = mid;
            }
        }
    }
    for (int i = 0; i < len; i++) {
        cout << a[i].name <<" "<< a[i].age <<"  "<< a[i].gender << endl;
    }

    return 0;
}
